#include <stdio.h>
#include <unistd.h>
#define BUF_SIZE 30

int main() {
    int fd[2];
    pipe(fd);
    char str[] = "who are you?";
    char buf[BUF_SIZE];
    
    pid_t pid = fork();
    if (pid == 0) {
        // 从1写入
        write(fd[1], str, sizeof(str));
    } else {
        // 从0读出
        read(fd[0], buf, BUF_SIZE);
        puts(buf);
    }
    return 0;
}